#include<cstdio>
int n;
int a[100001];
int f[100001][2];
int from[100001][2],to[100001][2];
int main()
{
	freopen("test.in","r",stdin);
	freopen("test.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int k;
		scanf("%d",&k);
		for(int j = 1 ; j<= k; j++)
			scanf("%d",&a[j]);
		f[1][1] = a[1];from[1][1]=1;to[1][1]=1;
		f[1][0] =-2100000000;from[1][0]=0;to[1][0]=0;
		for(int j = 2; j <= k; j++)
		{
		//	f[j][1] = max(f[j-1][1] + a[j],a[j]);
			//printf("%d",a[j]);
			if(f[j-1][1]+a[j]>=a[j])
			{
				f[j][1]=f[j-1][1]+a[j];
				from[j][1]=from[j-1][1];
				to[j][1]=j;
			}
			else 
			{
				f[j][1]= a[j];
				from[j][1]=j;
				to[j][1]=j;
			}
			if(f[j-1][1]>=f[j-1][0])
			{
				f[j][0] = f[j-1][1];
				from[j][0] = from[j-1][1];
				to[j][0] = to[j-1][1];
			}
			else{
				f[j][0] = f[j-1][0];
				from[j][0] = from[j-1][0];
				to[j][0] = to[j-1][0];
			    }
		//	f[i,0] = max(f[i-1,1] , f[i-1][0]);
		}
		
		if(f[k][1]>f[k][0])printf("Case %d:\n%d %d %d\n",i,f[k][1],from[k][1],to[k][1]);
		else printf("Case %d:\n%d %d %d\n",i,f[k][0],from[k][0],to[k][0]);
		if(i!=n)printf("\n");
	}
	return 0;
}

		

